home *** CD-ROM | disk | FTP | other *** search
/ Business Assistant / Business Assistant.iso / indus / rental / tenant.prg < prev   
Text File  |  1986-05-30  |  17KB  |  540 lines

  1. *    Last revision: May 26, 1986 at 11:43
  2. * tenant.prg main command program of tenant database
  3. STOR .t. TO first
  4. * set up the loop
  5. STOR .T. to more
  6. DO WHIL more
  7. * if first time this trip
  8.  IF first
  9.   DO t_first
  10.   STOR .f. TO first
  11.  ENDI
  12.  STOR '<B>ackward, <D>elete/Recall, <E>dit, <F>orward, <H>elp, <P>rint' TO prompt1
  13.  STOR '<S>earch by code number, search a<N>y part of database' TO prompt2
  14.  STOR 'b<u>ilding records or <R>eturn to main Menu           SELECT: ' TO prompt3
  15.  STOR 'Main Tenant Database ' TO mode
  16.  STOR '?' TO command
  17. * find out if the current record is marked for deletion
  18.  IF DELETE()
  19.   STOR 'Deleted' TO deleted
  20.  ELSE
  21.   STOR '       ' TO deleted
  22.  ENDI *
  23.  STOR trent TO trentx
  24.  IF ttype = 'P'
  25.   IF (trentpc*(trentpcr/100)/12)>trent
  26.    STOR (trentpc*(trentpcr/100)/12) TO trentx
  27.   ENDI (trentpc)
  28.  ENDI ttype = 'P'
  29.  IF ttype = 'O'
  30.   STOR ((trentpc*(trentpcr/100)/12)+trent) TO trentx
  31.  ENDI ttype = 'O'
  32.  STOR (trentx + taddl + trente + trentm) TO trentxx
  33. * show the current record, and find out what to do next
  34.  @ 0, 0 SAY deleted
  35.  @ 1,26 SAY mode
  36.  @ 3,10 SAY tenant
  37.  @ 3,62 SAY bcode
  38.  @ 4,10 SAY tunit
  39.  @ 4,36 SAY baddr
  40.  @ 5,10 SAY tcontac
  41.  @ 5,62 SAY tphone
  42.  @ 6,36 SAY alt
  43.  @ 7,10 SAY altad
  44.  @ 8,10 SAY altcty
  45.  @ 10,10 SAY ttype
  46.  @ 10,36 SAY trentpc PICTURE '99.9999'
  47.  @ 10,62 SAY tfirst
  48.  @ 11,10 SAY trentpcr PICTURE '999,999,999'
  49.  @ 11,62 SAY texpir
  50.  @ 12,10 SAY tsec PICTURE '99,999.99'
  51.  @ 12,36 SAY tsecb
  52.  @ 12,62 SAY tlate
  53.  @ 13,10 SAY trent PICTURE '99,999.99'
  54.  @ 13,36 SAY tlatec PICTURE '99,999.99'
  55.  @ 13,62 SAY taddl PICTURE '99,999.99'
  56.  @ 14,10 SAY trente PICTURE '99,999.99'
  57.  @ 14,36 SAY trentm PICTURE '99,999.99'
  58.  @ 14,62 SAY trentxx PICTURE '99,999.99'
  59.  @ 15,10 SAY trentd PICTURE '99,999.99'
  60.  @ 15,36 SAY trentpd PICTURE '99/99/99'
  61.  @ 15,62 SAY trentp PICTURE '99,999.99'
  62.  @ 16,10 SAY trenty PICTURE '99,999.99'
  63.  @ 16,36 SAY tflag
  64.  @ 16,62 SAY trentt PICTURE '99,999.99'
  65.  @ 18,10 SAY tnotes
  66.  @ 18,61 SAY tupdate
  67.  @ 20, 7 SAY prompt1
  68.  @ 21, 7 SAY prompt2
  69.  @ 22, 7 SAY prompt3
  70.  @ 22,70 GET command PICTURE '!'
  71.  READ
  72. * perform selected function
  73.  DO CASE
  74.  CASE (command = 'B' .OR. command = ',' )
  75. * move backwards one record
  76.   SKIP -1
  77.   LOOP
  78.  CASE command = 'D'
  79. * switch the current record from deleted to recalled
  80.   IF DELETE()
  81.    RECA
  82.   ELSE
  83.    DELE
  84.   ENDI DELETE()
  85.   LOOP
  86.  CASE command = 'E'
  87.   SET DELIMITER OFF
  88.   SET INTENSITY ON
  89. * store field variables into mem variables for editing
  90.   STOR tenant TO mtenant
  91.   STOR bcode TO mbcode
  92.   STOR tunit TO mtunit
  93.   STOR baddr TO mbaddr
  94.   STOR tcontac TO mtcontac
  95.   STOR tphone TO mtphone
  96.   STOR alt TO malt
  97.   STOR altad TO maltad
  98.   STOR altcty TO maltcty
  99.   STOR ttype TO mttype
  100.   STOR trentpc TO mtrentpc
  101.   STOR texpir TO mtexpir
  102.   STOR trentpcr TO mtrenpcr
  103.   STOR tfirst TO mtfirst
  104.   STOR tsec TO mtsec
  105.   STOR tsecb TO mtsecb
  106.   STOR tlate TO mtlate
  107.   STOR trent TO mtrent
  108.   STOR taddl TO mtaddl
  109.   STOR trente TO mtrente
  110.   STOR trentm TO mtrentm
  111.   STOR trentp TO mtrentp
  112.   STOR trentpd TO mtrentpd
  113.   STOR tlatec TO mtlatec
  114.   STOR trentd TO mtrentd
  115.   STOR trenty TO mtrenty
  116.   STOR trentt TO mtrentt
  117.   STOR tflag TO mtflag
  118.   STOR tnotes TO mtnotes
  119.   STOR tupdate TO mtupdate
  120. * set up screen and prompt for editing
  121.   STOR 'Edit Tenant Data          ' TO mode
  122.   STOR '                 Enter the new or corrected information        ' TO prompt1
  123.   STOR "                 Control 'Q'or 'W' to end edit session   " TO prompt2
  124.   STOR SPACE(70) TO prompt3
  125.   @ 1,26 SAY mode
  126.   @ 3,10 GET mtenant
  127.   @ 3,62 GET mbcode PICTURE '99999'
  128.   @ 4,10 GET mtunit
  129.   @ 4,36 GET mbaddr
  130.   @ 5,10 GET mtcontac
  131.   @ 5,62 GET mtphone PICTURE '(999)999-9999'
  132.   @ 6,36 GET malt PICTURE '!'
  133.   @ 7,10 GET maltad
  134.   @ 8,10 GET maltcty
  135.   @ 10,10 GET mttype PICTURE '!'
  136.   @ 10,36 GET mtrentpc
  137.   @ 10,62 GET mtfirst PICTURE '99/99/99'
  138.   @ 11,10 SAY SPACE(16)
  139.   @ 11,10 GET mtrenpcr
  140.   @ 11,62 GET mtexpir PICTURE '99/99/99'
  141.   @ 12,10 GET mtsec
  142.   @ 12,36 GET mtsecb
  143.   @ 12,62 GET mtlate PICTURE '99'
  144.   @ 13,10 GET mtrent
  145.   @ 13,36 GET mtlatec
  146.   @ 13,62 GET mtaddl
  147.   @ 14,10 GET mtrente
  148.   @ 14,36 GET mtrentm
  149.   @ 15,10 GET mtrentd
  150.   @ 15,36 GET mtrentpd PICTURE '99/99/99'
  151.   @ 15,62 GET mtrentp
  152.   @ 16,10 GET mtrenty
  153.   @ 16,36 GET mtflag PICTURE '99/99/99'
  154.   @ 16,62 GET mtrentt
  155.   @ 18,10 GET mtnotes
  156.   @ 18,61 GET mtupdate PICTURE '99/99/99'
  157.   @ 20,07 SAY prompt1
  158.   @ 21,07 SAY prompt2
  159.   @ 22,07 SAY prompt3
  160.   READ
  161.   CLEA GETS
  162. * test if there is a bad field validation
  163.   DO CASE
  164.   CASE mbcode = ' '
  165.    STOR .t. TO error
  166.   CASE .NOT.(malt = 'Y' .OR. malt = 'N')
  167.    STOR .t. TO error
  168.   CASE .NOT.(mttype = 'R'.OR.mttype='P'.OR. mttype='O')
  169.    STOR .t. TO error
  170.   CASE (mttype = 'P'.OR. mttype = 'O') .AND.(.NOT.(mtrentpc >0.AND. mtrenpcr >0))
  171.    STOR .t. TO error
  172.   OTHE
  173.    STOR .f. TO error
  174.   ENDC
  175. * if test for error was true then fix the fields that need fixing
  176.   IF error
  177. * erase the lines to be used for prompts
  178.    @ 01,00
  179.    @ 20,00
  180.    @ 21,00
  181.    @ 22,00
  182. * tell them to correct it
  183.    @ 1,18 SAY 'Please Correct the Indicated Data'
  184. * keep looping until all fields are fixed
  185.    STOR .t. to an_error
  186.    DO WHIL an_error
  187.     DO CASE
  188.     CASE mbcode = ' '
  189.      @ 20,01 SAY SPACE(75)
  190.      @ 21,01 SAY SPACE(75)
  191.      @ 20,15 SAY 'Must have a tenant code       '
  192.      @ 03,62 GET mbcode PICTURE '99999'
  193.      READ
  194.     CASE .NOT.(malt = 'Y' .OR. malt = 'N')
  195.      @ 20,01 SAY SPACE(75)
  196.      @ 21,01 SAY SPACE(75)
  197.      @ 20,15 SAY "Must answer 'Y' or 'N' to alternate address"
  198.      @ 06,36 GET malt PICTURE '!'
  199.      READ
  200.     CASE .NOT.(mttype = 'R'.OR.mttype='P'.OR. mttype='O')
  201.      @ 20,01 SAY SPACE(75)
  202.      @ 21,01 SAY SPACE(75)
  203.      @ 20,05 SAY "Type must be 'R' for Regular, 'P' for Percentage which uses the higher of"
  204.      @ 21,05 SAY "the percentage or the base rent or 'O' for Overage plus base rent"
  205.      @ 10,10 GET mttype PICTURE '!'
  206.      READ
  207.     CASE (mttype = 'P'.OR. mttype = 'O').AND.(.NOT.(mtrentpc>0.AND. mtrenpcr> 0))
  208.      @ 20,01 SAY SPACE(75)
  209.      @ 21,01 SAY SPACE(75)
  210.      @ 20,05 SAY 'If a percentage or overage lease, you must state the percentage'
  211.      @ 21,05 SAY 'AND the base for calculating the percentage rent'
  212.      @ 10,36 GET mtrentpc
  213.      @ 11,10 GET mtrenpcr
  214.      READ
  215.     OTHE
  216.      STOR .f. TO an_error
  217.     ENDC
  218.    ENDD while an:error
  219.   ENDI error
  220.   STOR 'N' TO command
  221.   SET DELIMITER ON
  222.   SET INTENSITY OFF
  223.   @ 20,01 SAY SPACE(75)
  224.   @ 21,01 SAY SPACE(75)
  225.   @ 20,23 SAY 'Are there any more changes ?   '
  226.   @ 20,50 GET command picture '!'
  227.   READ
  228.   SET INTENSITY ON
  229.   SET DELIMITER OFF
  230.   IF command = 'Y'
  231.    @ 1,00
  232.    @ 1,26 SAY mode
  233.    @ 3,10 GET mtenant
  234.    @ 3,62 GET mbcode PICTURE '99999'
  235.    @ 4,10 GET mtunit
  236.    @ 4,36 GET mbaddr
  237.    @ 5,10 GET mtcontac
  238.    @ 5,62 GET mtphone PICTURE '(999)999-9999'
  239.    @ 6,36 GET malt PICTURE '!'
  240.    @ 7,10 GET maltad
  241.    @ 8,10 GET maltcty
  242.    @ 10,10 GET mttype PICTURE '!'
  243.    @ 10,36 GET mtrentpc
  244.    @ 10,62 GET mtfirst PICTURE '99/99/99'
  245.    @ 11,10 GET mtrenpcr
  246.    @ 11,62 GET mtexpir PICTURE '99/99/99'
  247.    @ 12,10 GET mtsec
  248.    @ 12,36 GET mtsecb
  249.    @ 12,62 GET mtlate PICTURE '99'
  250.    @ 13,10 GET mtrent
  251.    @ 13,36 GET mtlatec
  252.    @ 13,62 GET mtaddl
  253.    @ 14,10 GET mtrente
  254.    @ 14,36 GET mtrentm
  255.    @ 15,10 GET mtrentd
  256.    @ 15,36 GET mtrentpd PICTURE '99/99/99'
  257.    @ 15,62 GET mtrentp
  258.    @ 16,10 GET mtrenty
  259.    @ 16,36 GET mtflag PICTURE '99/99/99'
  260.    @ 16,62 GET mtrentt
  261.    @ 18,10 GET mtnotes
  262.    @ 18,61 GET mtupdate PICTURE '99/99/99'
  263.    @ 20,01 SAY SPACE(75)
  264.    @ 21,01 SAY SPACE(75)
  265.    @ 22,01 SAY SPACE(75)
  266.    @ 20,07 SAY prompt1
  267.    @ 21,07 SAY prompt2
  268.    @ 22,07 SAY prompt3
  269. * let user enter data
  270.    READ
  271.    CLEA GETS
  272.   ENDI command = 'Y'
  273.   REPL tenant WITH mtenant, bcode WITH mbcode, tunit WITH mtunit
  274.   REPL baddr WITH mbaddr, tcontac WITH mtcontac, tphone WITH mtphone
  275.   REPL alt WITH malt, altad WITH maltad, altcty WITH maltcty
  276.   REPL ttype WITH mttype, texpir WITH mtexpir
  277.   REPL trentpc WITH mtrentpc, trentpcr WITH mtrenpcr
  278.   REPL tfirst WITH mtfirst, tsec WITH mtsec, tsecb WITH mtsecb
  279.   REPL t